<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="Public:meta" />
	<style>
		#InfoHit{	color:#00F;	font-weight:bold;}
		label{	color:#00F; 	line-height:21px; 	font-weight:bold; 	height:21px; 	vertical-align:middle;	font-size:12px;}
		.mytip{	display:none; 	background-color:#FFF;	padding:6px; 	line-height:22px;	text-align:left;	border:1px solid #CCC;}
	</style>
</head>
<body id="main_page">
<include file="Public:position" />
<div class="container">
    <form enctype="multipart/form-data"  method="post" id="frmInfo">
    <input type="hidden" name="ChannelID" id="ChannelID" value="{$ChannelID}" />
    <input type="hidden" name="NowPage" id="NowPage" value="{$NowPage}" />
    <input type="hidden" name="ChannelModelID" id="ChannelModelID" value="{$ChannelModelID}" />
      <div class="table">
        <div class="toolbars">
            <li class="toolbar"><a id="btnSaveAll" href="{$Url}Add/ChannelID/{$ChannelID}/ChannelModelID/37"  title="添加反馈内容" target="_self">添加反馈内容</a></li>
            <li class="toolbar"><a id="btnSave" href="{$Url}exportFeedback/ChannelID/{$ChannelID}"  title="导出所有数据为CSV" target="_self">导出所有数据</a></li>
            <li class="toolbar"><a id="btnConfig" href="__GROUP__/Config/feedback/ChannelID/{$ChannelID}"  title="设置">&nbsp;设置</a></li>
            <li class="toolbar"><a id="selectall" onclick="CheckAll()"  title="全选">全选</a></li>
            <li class="toolbar"><a id="del" onclick="BatchDel()" title="批量删除">删除</a></li>
            <li class="toolbar"><a id="btnCheck" onclick="BatchCheck(1)" title="批量通过审核">审核</a></li>
            <li class="toolbar"><a id="btnUnCheck" onclick="BatchCheck(0)" title="批量取消审核">取消审核</a></li>
            <li class="toolbar toolbarform">
                <label>关键词</label><input type="text" class='textinput' name="Keywords" style="width:180px" value="{$Keywords}" id="Keywords"/>
                <label>会员ID</label><input type="text" class='textinput' name="MemberID"  style="width:40px"  value="{$MemberID}" />
                <label>是否审核</label>
                <select name="IsCheck" id="IsCheck">
                    <option value="-1">全部</option>
                    <option value="1">已审核</option>
                    <option value="0">未审核</option>
                </select>
                <input id="btnSeek" class="btnToolbarForm" type="submit" value="查询" onclick="Search()">
            </li>
        </div>
        <table class="datatable" id="datatable">
        <tr>
            <th width="40px"  nowrap="nowrap">选中</th>
            <th width="50px" nowrap="nowrap">ID</th>             
            <th >内容</th>
            <th width="160px" >反馈人身份</th>
            <th width="125px" nowrap="nowrap">时间</th>
            <th width="60px" >是否审核</th>
            <th style="width:150px">操作</th>
        </tr>  
        <notempty name="Info">                
            <volist name="Info" id="i" key="n">
                <tr id="t{$i.InfoID}">
                    <td><input class="checkrow" type="checkbox" name="InfoID[]" value="{$i.InfoID}" /></td>
                    <td>{$i.InfoID}</td>
                    <td style="text-align:left">{$i.AllInfo}</td>
                    <td>&nbsp;<span style="color:#000;font-weight:bold">{$i.MemberName}
                    <eq name="i.MemberID" value="0">[&nbsp;游客&nbsp;]<else/><span style="color:red">[会员]</span></eq>
                    </td>
                    <td>{$i.InfoTime|strtotime|yd_friend_date}</td>
                    <td>
                        <eq name="i.IsCheck" value="0">
                        	<span style="color:#F00;cursor:pointer;"  onclick="toggleStatus(this,{$i.InfoID},'info','未审核',0,'#F00','已审核',1,'#000','IsCheck')">未审核</span>
                        <else/>
                        	<span style="color:#000;cursor:pointer;"  onclick="toggleStatus(this,{$i.InfoID},'info','未审核',0,'#F00','已审核',1,'#000','IsCheck')">已审核</span>
                        </eq>
                    </td>
                    <td class="operator">
                        <a style="float:left" onclick="Edit({$i.InfoID})" id="btnEdit">修改</a>
                        <div class="btn-sep"></div>
                        <a style="float:left" onclick="Del({$i.InfoID})" class="btnDel">删除</a>
                    </td>
                </tr>
            </volist>
        <else/>
            <tr><td colspan="7" id="NoData">{$Think.lang.NoDataTip}</td></tr>
        </notempty>                                
        </table>
        <div class="tfoot">
          <div class="page"><span class="pagesize">每页<span class="pz">{$AdminPageSize}</span>条</span>{$Page}</div>
        </div>
    </div>
</form>
</div>
</body>
</html>
<script type="text/javascript">
//批量删除
function BatchDel(){
	//var arrChk = $("input[name='InfoID[]'][checked]"); //在高速浏览器长度总是返回0
	var arrChk = $("input[name='InfoID[]']");
	var n = 0;
	for(var i = 0; i < arrChk.length; i++){
		if(arrChk[i].checked) n++;
	}
	
	if( n == 0 ) {
		WarnBox("{$Think.lang.CheckDeleteTip}");
		return;
	}
	
	$.confirm("{$Think.lang.DeleteTip}", function () {
		$('#frmInfo').attr("action", "__URL__/batchDelFeedback");
		$('#frmInfo').submit();
	}, function () {
		return true;
	});
}

//查询
function Search(){
	$('#frmInfo').attr("action", "__URL__/feedback/ChannelID/{$ChannelID}");
	$('#frmInfo').submit();
	return true;
}

//批量审核
function BatchCheck(bCheck){
	//先必须选中记录==============================================
	var arrChk = $("input[name='InfoID[]']");
	var n = 0;
	for(var i = 0; i < arrChk.length; i++){
		if(arrChk[i].checked) n++;
	}
	if( n == 0 ) {
		WarnBox("请先选中记录!");
		return;
	}
	//=========================================================
	if( bCheck == 1 ){
		$.confirm("<div id='icon_common'>确定审核通过吗?</div>", function () {
			$('#frmInfo').attr("action", "{$Url}batchCheckFeedback/Check/1");
			$('#frmInfo').submit();
		}, function () {
			return true;
		});
	}else{
		$.confirm("<div id='icon_common'>确定取消审核吗?</div>", function () {
			$('#frmInfo').attr("action", "{$Url}batchCheckFeedback/Check/0");	
			$('#frmInfo').submit();
		}, function () {
			return true;
		});
	}
}

function Del(id){
	$.confirm("{$Think.lang.DeleteTip}", function () {
		var para = "?Keywords={$Keywords}&MemberID={$MemberID}&IsCheck={$IsCheck}";
		url = "{$Url}delFeedback/InfoID/"+id+"/ChannelID/{$ChannelID}/p/{$NowPage}"+para;
		location.href = url;
	}, function () {
		return true;
	});
}

function Edit(id){
	url = "{$Url}modify/InfoID/"+id+"/ChannelModelID/{$ChannelModelID}";
	location.href = url;
}

$(document).ready(function(){
	$("#IsCheck").attr("value",'{$IsCheck}');
	$("#Keywords").focus();
});
</script>